package com.hpin.fansea.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hpin.fansea.R;
import com.hpin.fansea.bean.GuideClassifyDetail;

import java.util.List;

/**
 * Created by Aaron on 15/9/9.
 */
public class GuideClassifyAdapter extends BaseAdapter {

    private Context ctx;
    private List<GuideClassifyDetail> list;

    public GuideClassifyAdapter(Context ctx, List<GuideClassifyDetail> list) {
        super();
        this.ctx = ctx;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHoleder holeder = null;
        if (convertView == null) {
            convertView = View.inflate(ctx, R.layout.item_classify,
                    null);
            holeder = new ViewHoleder();
            holeder.tv_name = (TextView) convertView.findViewById(R.id.item_category_name);

            convertView.setTag(holeder);
        }else {
            holeder = (ViewHoleder) convertView.getTag();
        }

        holeder.tv_name.setText(list.get(position).guideTypeName);
        return convertView;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    private class ViewHoleder {
        TextView tv_name;
    }

}
